package com.tech.platform.cms.admin.controller;

import com.tech.platform.cms.admin.dao.pojo.SubSystem;
import com.tech.platform.cms.admin.service.SubSystemService;
import com.tech.platform.cms.common.model.CommonResult;
import com.tech.platform.cms.common.model.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/admin/system")
public class SystemController {

    @Autowired
    private SubSystemService subSystemService;

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public CommonResult<String> add(SubSystem system){
        return subSystemService.add(system);
    }

    @RequestMapping(value = "/update",method = RequestMethod.PUT)
    public CommonResult<String> update(SubSystem system){
        return subSystemService.update(system);
    }

    @RequestMapping(value = "/delete/{id}",method = RequestMethod.DELETE)
    public CommonResult<String> update(@PathVariable int id){
        return subSystemService.delete(id);
    }

    @RequestMapping(value = "/page",method = RequestMethod.GET)
    public PageResult<List<SubSystem>> page(int current,int size,String keyWord){
        return subSystemService.page(current,size,keyWord);
    }
}
